<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title>常用对象的应用</title>
	</head>
	<body>
	<script>
		// //Number
		// console.log(Number(true),Number(null),+undefined);
		// //Boolean
		// console.log(Boolean('100'),Boolean(100),Boolean(null),!!undefined);
		// //parselnt
		// console.log(parseInt(123.6),parseInt(0b1011011),parseInt(0X2A),parseInt(0X2A,8));
		// //parseFloat
		// console.log(poarseFloat('123.6'),parseFloat('100px'),parseFloat(010));
		// //eval
		// console.log(eval('87*99+2'));
		// //isNaN
		// console.log(isNaN(null),isNaN('123'),isNaN('abc'),isNaN('a1b2c3'));
		
		//2(1)
		var arr1 = [];
		console.log(arr1,arr1,length);
		var arr2 = [1,2,3];
		arr2.shift()
		console.log(arr2[0],arr2,length);
		var arr3 = new Array();
		console.log(arr3[1],arr3,length);
	
		//3
		var d = new Date();

	
		//4(1)
		var reg1 = /^\d{4}$/;
		console.log(reg1.test('1234'),
			reg1.test('1a34'),
			reg1.test('12345')
		)
		
		//4(2)
		var reg2 = new RegExp("^[sp]\\d{1,4}$","i");
		console.log(reg2.test('p123'),
			reg2.test('1234'),
			reg2.test('S10')
		)

		//7
		var x = 1;
		function A(y){
			var x = 2;
			function B(z){
				console.log(x+y+z);
			}
			return B;
		}
		var C = A(2);
		C(3);
	</script>
	
	</body>
</html>